--TEST--
Check for function watching
--FILE--
<?php
$output_dir = realpath(ini_get('pdlogger.output_dir'));

function watch_normal_func($class_name, $func_name, $spent, $args, $called_obj)
{
	return var_export($args, true);
}

class ClassToWatch {
	public function foo() {}
}

// prepare
pdl_enable(true);
pdl_watch(PDL_W_FUNC);
pdl_watch_func("normal_func", "watch_normal_func");
pdl_watch_func("strpos");
pdl_watch_func("ClassToWatch::foo");

pdl_start(true);

function normal_func($foo, $bar) {
	// empty
}

class FooClass {
	public function fooMethod($foo, $bar) {
		// empty
	}
}

// normal function
normal_func('foo', 'bar');

// with class
$ctw = new ClassToWatch();
$ctw->foo();

// internal function
strpos("aaa", "aaaaaa");

pdl_stop(true);

$period = (int) ini_get('pdlogger.period');
$time = time();
$time = ($time - ($time % $period));
$text_log_file = $output_dir . "/text/$time.log";

echo file_get_contents($text_log_file);

if (is_file($text_log_file)) {
	unlink($text_log_file);
}
?>
--EXPECTF--
# Copyright (c) 2012, Zoujie Wu. Generated by PDLogger 1.0.0
#
#   Record from %s
#   Change log after %d sec(s)


@start %d+%d
[%s] [Info] [Watch] Call normal_func() with args in %f msec(s), see detail for more info @%s009.php:%d
  function args: array[2] (
    [0] => (string) 'foo',
    [1] => (string) 'bar',
  )
[%s] [Info] [Watch] Call ClassToWatch::foo() with args in %f msec(s), see detail for more info @%s009.php:%d
  function args: array[0] ()
[%s] [Info] [Watch] Call strpos() with args in %f msec(s), see detail for more info @%s009.php:%d
  function args: array[2] (
    [0] => (string) 'aaa',
    [1] => (string) 'aaaaaa',
  )
